{-# LANGUAGE ScopedTypeVariables        #-}

module DemoAssoc where

import Ochre


import Control.Monad



demo01 = either putStr putStr $ compileOrch default_opts $ do
    instr 1 instr01


demo02 = either putStr putStr $ debugInstr 1 instr01
demo03 = either putStr putStr $ debugInstrAlpha 1 instr01
demo04 = either putStr putStr $ debugInstrAlphaBeta 1 instr01
demo05 = either putStr putStr $ debugInstrAlphaBetaAssoc 1 instr01
demo06 = either putStr putStr $ debugInstrAlphaBetaAssocCF 1 instr01
demo07 = either putStr putStr $ debugInstrOptimize1 1 instr01
demo08 = either putStr putStr $ debugInstrOptimize2 1 instr01
demo09 = either putStr putStr $ debugInstrOptimize3 1 instr01

table1 :: TableIx
table1 = tableIx 1


phasesig :: IKA_Signal ra => Sig ra -> TableIx -> InstCode ASig
phasesig insig itbl = 
    letsig1 (phasor insig)              ARate $ \aphs ->
    letsig1 (tablei_ aphs itbl 1 0 1)   ARate $ \asig ->
    liftS asig


instr01 :: Instr
instr01 = defInstr $ return $ 
    letsig1 (phasesig (1.0 :: ASig) table1)       ARate   $ \asig ->
    out asig

